package com.cm.caseManagement.service.impl;
import com.cm.caseManagement.utils.DateUtils;

import com.cm.caseManagement.dao.CmSysUserRoleMapper;
import com.cm.caseManagement.pojo.entity.CmSysUserRole;
import com.cm.caseManagement.service.ICmSysUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户角色关联Service业务层处理
 *
 * @author ruoyi
 * @date 2025-10-05
 */
@Service
public class CmSysUserRoleServiceImpl implements ICmSysUserRoleService
{
    @Autowired
    private CmSysUserRoleMapper cmSysUserRoleMapper;

    /**
     * 查询用户角色关联
     *
     * @param id 用户角色关联主键
     * @return 用户角色关联
     */
    @Override
    public CmSysUserRole selectCmSysUserRoleById(Long id)
    {
        return cmSysUserRoleMapper.selectCmSysUserRoleById(id);
    }

    /**
     * 查询用户角色关联列表
     *
     * @param cmSysUserRole 用户角色关联
     * @return 用户角色关联
     */
    @Override
    public List<CmSysUserRole> selectCmSysUserRoleList(CmSysUserRole cmSysUserRole)
    {
        return cmSysUserRoleMapper.selectCmSysUserRoleList(cmSysUserRole);
    }

    /**
     * 新增用户角色关联
     *
     * @param cmSysUserRole 用户角色关联
     * @return 结果
     */
    @Override
    public int insertCmSysUserRole(CmSysUserRole cmSysUserRole)
    {
        cmSysUserRole.setCreateTime(DateUtils.getNowDate());
        return cmSysUserRoleMapper.insertCmSysUserRole(cmSysUserRole);
    }

    /**
     * 修改用户角色关联
     *
     * @param cmSysUserRole 用户角色关联
     * @return 结果
     */
    @Override
    public int updateCmSysUserRole(CmSysUserRole cmSysUserRole)
    {
        return cmSysUserRoleMapper.updateCmSysUserRole(cmSysUserRole);
    }

    /**
     * 批量删除用户角色关联
     *
     * @param ids 需要删除的用户角色关联主键
     * @return 结果
     */
    @Override
    public int deleteCmSysUserRoleByIds(Long[] ids)
    {
        return cmSysUserRoleMapper.deleteCmSysUserRoleByIds(ids);
    }

    /**
     * 删除用户角色关联信息
     *
     * @param id 用户角色关联主键
     * @return 结果
     */
    @Override
    public int deleteCmSysUserRoleById(Long id)
    {
        return cmSysUserRoleMapper.deleteCmSysUserRoleById(id);
    }
}
